package com.mopa.qzonegallery;
import java.util.ArrayList;
import java.util.List;

import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
public class FolderAdapter extends BaseAdapter{
	private Context 				mContext;	
	public  List<FolderItemInfo> 	Allitems;
	public FolderAdapter(Context context)
	{
		mContext=context;
		Allitems=new ArrayList<FolderItemInfo>();
	}
	
    public void clear()
    {
	   Allitems.clear();
	   notifyDataSetChanged();
    }
    public void add(FolderItemInfo item)
     {
    	Allitems.add(item);
    }
    public void remove(FolderItemInfo item)
     {
    	Allitems.remove(item);
     }
	   
	@Override
	public int getCount() {
		// TODO Auto-generated method stub
		return Allitems.size();
	}

	@Override
	public FolderItemInfo getItem(int position) {
		// TODO Auto-generated method stub
		return Allitems.get(position);
	}

	@Override
	public long getItemId(int position) {
		// TODO Auto-generated method stub
		return position;
	}

	@Override
	public View getView(int position, View convertView, ViewGroup parent) {
		// TODO Auto-generated method stub
		FolderItemLayout curFolderItem=(FolderItemLayout) convertView;
		if(curFolderItem==null)
		{
			curFolderItem=new FolderItemLayout(mContext);
		}
		curFolderItem.initItem(getItem(position),position);
		return curFolderItem;
	}

}
